import request from '@/config/axios'
import * as classifyApi from '@/api/classify'
import { reactive } from 'vue'

// 查询图片库列表
export const page = async (params: PageParam) => {
  return await request.get({ url: '/word/page', params })
}
/**
 * 预览文档(先根据id返回文档实例)
 * @param params
 */
export const preview = async (id: number) => {
  debugger
  return await request.get({ url: '/word/preview?id=' + id })
}
//查询图片分类
export const getPictureClassify = async () => {
  return await classifyApi.selectClassify('picture')
}

/**
 * 保存单张图片
 * @param params
 */
export const savePicture = async (params: PageParam) => {
  console.log(params)
  return await request.post({ url: '/picture/save', data: params })
}

/**
 * 根据ID查询
 * @param params
 */
export const selectOne = async (id: String) => {
  return await request.get({ url: '/picture/' + id + '/one' })
}

export const upload = (data) => {
  debugger
  return request.upload({ url: '/word/upload', data: data })
}
